import Vue from 'vue';
import App from './App.vue';
import router from './router'; //主路由文件引入
import store from './store'; //本地缓存服务引入

const { i18n } = require('w-vue-basis');

if (!global._babelPolyfill) {
  require('babel-polyfill');
}
import './themes/index.less';

import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts;

//主框架应用注册
import { winMiddle } from 'w-vue-middle';

const subApp = new winMiddle(Vue, {
  defaultPage: '/modelHDW', //默认打开的页面
  systemName: '新桥指标管理平台',
  loginConfig: {
    //登录配置
    showLogo: true, //是否显示logo
    logoIcon: require('/static/images/WiNEX_DnA.png'), //标题图片
    title: '新桥指标管理平台', //欢迎文案
    desc: 'Welcome aboard', //欢迎文案
    body: {
      //系统背景
      background: `url('${require('/static/images/bg_dna.jpg')}') no-repeat `,
      backgroundSize: '100% 100%',
    },
  },
  ...window.appService,
});

Vue.config.productionTip = false;

if (process.env.NODE_ENV === 'development') {
  //关闭菜单权限
  $storage.set('SYS_Authority_Disable', 'false');
}

//微前端应用注册
import { microRegister } from 'w-vue-middle/microService';

/**
 * @Author: Jason Liu
 * @description: 微前端服务主持
 */
let micro = new microRegister({
  i18n,
  el: '#app',
  router,
  store,
  render: (h) => h(App),
});

export async function bootstrap(props) {
  micro.bootstrap(props);
}

export async function mount(props) {
  micro.mount(props);
}

export async function unmount(props) {
  micro.unmount(props);
}

export async function update(props) {
  micro.update(props);
}
